package com.pactera.madp.cp.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pactera.madp.cp.api.dto.product.ProductEmployeeGroupUpdateDto;
import com.pactera.madp.cp.api.entity.product.ProdEmployeeGroupEntity;
import com.pactera.madp.cp.mapper.ProdEmployeeGroupMapper;
import com.pactera.madp.cp.service.ProdEmployeeGroupService;
import org.springframework.stereotype.Service;

/**
 * (CpProdEmployeeGroup)表服务实现类
 *
 * @author yushen.qi
 * @since 2021-12-23 16:15:32
 */
@Service("prodEmployeeGroupService")
public class ProdEmployeeGroupServiceImpl extends ServiceImpl<ProdEmployeeGroupMapper, ProdEmployeeGroupEntity> implements ProdEmployeeGroupService {

    @Override
    public boolean put(ProductEmployeeGroupUpdateDto dto) {
        ProdEmployeeGroupEntity entity = new ProdEmployeeGroupEntity();
        BeanUtil.copyProperties(dto,entity);
        return update(entity, Wrappers.<ProdEmployeeGroupEntity>lambdaQuery()
                .eq(ProdEmployeeGroupEntity::getEmployeeId,dto.getEmployeeId())
                .eq(ProdEmployeeGroupEntity::getProdGroupId,dto.getProdGroupId()));
    }

}
